<?php
/**
 * Pipahr
 * @brief An action to apply tpl text to textarea
 *
 * @author Randy Zhao
 * @copyright 2013 pipahr.com
 */
OCP\JSON::checkAppEnabled('calendar');

if(!OC_User::isLoggedIn()) {
   jexit(jsonError('您需要先登录', null, false));
}

$apply_id = $_GET['apply_id'] ? intval($_GET['apply_id']) : 0;
$tpl_type = JRequest::getString('tpl_type', '');

$tpl_model = new PCalendarModelTpl();

$notify_tpl = $tpl_model->getNotifyTplById($apply_id, $tpl_type);
if ( !$notify_tpl ) {
   jexit(jsonError($tpl_model->getError(), null, false));
}

jexit(jsonSuccess(array('notify_tpl'=>$notify_tpl), null, null, false));